{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-11T13:04:25.397243Z",
     "start_time": "2020-07-11T13:04:24.566987Z"
    }
   },
   "outputs": [],
   "source": [
    "import os\n",
    "import pandas as pd\n",
    "import numpy as np\n",
    "np.set_printoptions(precision=2)\n",
    "\n",
    "import matplotlib.pyplot as plt\n",
    "import seaborn as sns\n",
    "from scipy import stats\n",
    "from collections import Counter\n",
    "\n",
    "sns.set_style('ticks')\n",
    "\n",
    "%matplotlib inline\n",
    "import warnings\n",
    "warnings.filterwarnings('ignore')\n",
    "import matplotlib as mpl\n",
    "mpl.rcParams['figure.dpi']= 300\n",
    "mpl.rc(\"savefig\", dpi=300)\n",
    "\n",
    "from scipy.special import xlogy"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##### Read files and select drugs"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-11T13:04:25.404482Z",
     "start_time": "2020-07-11T13:04:25.399199Z"
    }
   },
   "outputs": [],
   "source": [
    "# log2_median_ic50, log2_median_ic50_9f, log2_median_ic50_hn, log2_median_ic50_9f_hn, log2_median_ic50_3f_hn, log2_max_conc\n",
    "ref_type = 'log2_median_ic50_hn' # log2_median_ic50_3f_hn | log2_median_ic50_hn\n",
    "model_name = 'hn_drug_cw_dw10_100000_model' # hn_drug_cw_dw10_100000_model | hn_drug_cw_dw1_100000_model | hn_drug_cw_dwsim10_100000_model\n",
    "\n",
    "dosage_shifted = False"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-11T13:04:30.022169Z",
     "start_time": "2020-07-11T13:04:30.019222Z"
    }
   },
   "outputs": [],
   "source": [
    "norm_type = 'patient_TPM'\n",
    "\n",
    "current_dir = '../result/HN_model/{}/'.format(norm_type)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-11T13:04:32.138505Z",
     "start_time": "2020-07-11T13:04:32.103022Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Drug Name</th>\n",
       "      <th>Synonyms</th>\n",
       "      <th>Target</th>\n",
       "      <th>Target Pathway</th>\n",
       "      <th>Selleckchem Cat#</th>\n",
       "      <th>CAS number</th>\n",
       "      <th>PubCHEM</th>\n",
       "      <th>Others</th>\n",
       "      <th>entropy</th>\n",
       "      <th>max_conc</th>\n",
       "      <th>...</th>\n",
       "      <th>median_ic50_9f</th>\n",
       "      <th>log2_median_ic50_9f</th>\n",
       "      <th>log2_median_ic50_hn</th>\n",
       "      <th>median_ic50_hn</th>\n",
       "      <th>median_ic50_3f_hn</th>\n",
       "      <th>log2_median_ic50_3f_hn</th>\n",
       "      <th>median_ic50_9f_hn</th>\n",
       "      <th>log2_median_ic50_9f_hn</th>\n",
       "      <th>num_sensitive</th>\n",
       "      <th>num_sensitive_hn</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Drug ID</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1001</th>\n",
       "      <td>AICA Ribonucleotide</td>\n",
       "      <td>AICAR, N1-(b-D-Ribofuranosyl)-5-aminoimidazole...</td>\n",
       "      <td>AMPK agonist</td>\n",
       "      <td>Metabolism</td>\n",
       "      <td>S1802</td>\n",
       "      <td>2627-69-2</td>\n",
       "      <td>65110</td>\n",
       "      <td>NaN</td>\n",
       "      <td>6.034272</td>\n",
       "      <td>2000.0000</td>\n",
       "      <td>...</td>\n",
       "      <td>206.748380</td>\n",
       "      <td>7.691732</td>\n",
       "      <td>9.939784</td>\n",
       "      <td>982.139588</td>\n",
       "      <td>327.379863</td>\n",
       "      <td>8.354822</td>\n",
       "      <td>109.126621</td>\n",
       "      <td>6.769859</td>\n",
       "      <td>476</td>\n",
       "      <td>27</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1003</th>\n",
       "      <td>Camptothecin</td>\n",
       "      <td>7-Ethyl-10-Hydroxy-Camptothecin, SN-38, Irinot...</td>\n",
       "      <td>TOP1</td>\n",
       "      <td>DNA replication</td>\n",
       "      <td>S1288</td>\n",
       "      <td>7689-03-4</td>\n",
       "      <td>104842</td>\n",
       "      <td>(SN-38, S4908, 86639-52-3) (Irinotecan, S1198,...</td>\n",
       "      <td>4.609530</td>\n",
       "      <td>0.1000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.002003</td>\n",
       "      <td>-8.963413</td>\n",
       "      <td>-7.587491</td>\n",
       "      <td>0.005199</td>\n",
       "      <td>0.001733</td>\n",
       "      <td>-9.172454</td>\n",
       "      <td>0.000578</td>\n",
       "      <td>-10.757416</td>\n",
       "      <td>688</td>\n",
       "      <td>30</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1004</th>\n",
       "      <td>Vinblastine</td>\n",
       "      <td>Velban</td>\n",
       "      <td>Microtubule destabiliser</td>\n",
       "      <td>Mitosis</td>\n",
       "      <td>S1248</td>\n",
       "      <td>143-67-9</td>\n",
       "      <td>6710780</td>\n",
       "      <td>NaN</td>\n",
       "      <td>4.297122</td>\n",
       "      <td>0.1000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.001599</td>\n",
       "      <td>-9.289051</td>\n",
       "      <td>-7.150982</td>\n",
       "      <td>0.007036</td>\n",
       "      <td>0.002345</td>\n",
       "      <td>-8.735945</td>\n",
       "      <td>0.000782</td>\n",
       "      <td>-10.320907</td>\n",
       "      <td>753</td>\n",
       "      <td>33</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1006</th>\n",
       "      <td>Cytarabine</td>\n",
       "      <td>Ara-Cytidine, Arabinosyl Cytosine, U-19920</td>\n",
       "      <td>Antimetabolite</td>\n",
       "      <td>DNA replication</td>\n",
       "      <td>S1648</td>\n",
       "      <td>147-94-4</td>\n",
       "      <td>6253</td>\n",
       "      <td>NaN</td>\n",
       "      <td>6.646594</td>\n",
       "      <td>2.0000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.163032</td>\n",
       "      <td>-2.616771</td>\n",
       "      <td>-1.342632</td>\n",
       "      <td>0.394301</td>\n",
       "      <td>0.131434</td>\n",
       "      <td>-2.927594</td>\n",
       "      <td>0.043811</td>\n",
       "      <td>-4.512557</td>\n",
       "      <td>508</td>\n",
       "      <td>25</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1007</th>\n",
       "      <td>Docetaxel</td>\n",
       "      <td>RP-56976, Taxotere</td>\n",
       "      <td>Microtubule stabiliser</td>\n",
       "      <td>Mitosis</td>\n",
       "      <td>S1148</td>\n",
       "      <td>114977-28-5</td>\n",
       "      <td>148124</td>\n",
       "      <td>NaN</td>\n",
       "      <td>4.220984</td>\n",
       "      <td>0.0125</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000761</td>\n",
       "      <td>-10.358915</td>\n",
       "      <td>-9.792998</td>\n",
       "      <td>0.001127</td>\n",
       "      <td>0.000376</td>\n",
       "      <td>-11.377960</td>\n",
       "      <td>0.000125</td>\n",
       "      <td>-12.962923</td>\n",
       "      <td>584</td>\n",
       "      <td>32</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 27 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                   Drug Name  \\\n",
       "Drug ID                        \n",
       "1001     AICA Ribonucleotide   \n",
       "1003            Camptothecin   \n",
       "1004             Vinblastine   \n",
       "1006              Cytarabine   \n",
       "1007               Docetaxel   \n",
       "\n",
       "                                                  Synonyms  \\\n",
       "Drug ID                                                      \n",
       "1001     AICAR, N1-(b-D-Ribofuranosyl)-5-aminoimidazole...   \n",
       "1003     7-Ethyl-10-Hydroxy-Camptothecin, SN-38, Irinot...   \n",
       "1004                                                Velban   \n",
       "1006            Ara-Cytidine, Arabinosyl Cytosine, U-19920   \n",
       "1007                                    RP-56976, Taxotere   \n",
       "\n",
       "                           Target   Target Pathway Selleckchem Cat#  \\\n",
       "Drug ID                                                               \n",
       "1001                 AMPK agonist       Metabolism            S1802   \n",
       "1003                         TOP1  DNA replication            S1288   \n",
       "1004     Microtubule destabiliser          Mitosis            S1248   \n",
       "1006               Antimetabolite  DNA replication            S1648   \n",
       "1007       Microtubule stabiliser          Mitosis            S1148   \n",
       "\n",
       "          CAS number  PubCHEM  \\\n",
       "Drug ID                         \n",
       "1001       2627-69-2    65110   \n",
       "1003       7689-03-4   104842   \n",
       "1004        143-67-9  6710780   \n",
       "1006        147-94-4     6253   \n",
       "1007     114977-28-5   148124   \n",
       "\n",
       "                                                    Others   entropy  \\\n",
       "Drug ID                                                                \n",
       "1001                                                   NaN  6.034272   \n",
       "1003     (SN-38, S4908, 86639-52-3) (Irinotecan, S1198,...  4.609530   \n",
       "1004                                                   NaN  4.297122   \n",
       "1006                                                   NaN  6.646594   \n",
       "1007                                                   NaN  4.220984   \n",
       "\n",
       "          max_conc  ...  median_ic50_9f  log2_median_ic50_9f  \\\n",
       "Drug ID             ...                                        \n",
       "1001     2000.0000  ...      206.748380             7.691732   \n",
       "1003        0.1000  ...        0.002003            -8.963413   \n",
       "1004        0.1000  ...        0.001599            -9.289051   \n",
       "1006        2.0000  ...        0.163032            -2.616771   \n",
       "1007        0.0125  ...        0.000761           -10.358915   \n",
       "\n",
       "         log2_median_ic50_hn  median_ic50_hn  median_ic50_3f_hn  \\\n",
       "Drug ID                                                           \n",
       "1001                9.939784      982.139588         327.379863   \n",
       "1003               -7.587491        0.005199           0.001733   \n",
       "1004               -7.150982        0.007036           0.002345   \n",
       "1006               -1.342632        0.394301           0.131434   \n",
       "1007               -9.792998        0.001127           0.000376   \n",
       "\n",
       "         log2_median_ic50_3f_hn  median_ic50_9f_hn  log2_median_ic50_9f_hn  \\\n",
       "Drug ID                                                                      \n",
       "1001                   8.354822         109.126621                6.769859   \n",
       "1003                  -9.172454           0.000578              -10.757416   \n",
       "1004                  -8.735945           0.000782              -10.320907   \n",
       "1006                  -2.927594           0.043811               -4.512557   \n",
       "1007                 -11.377960           0.000125              -12.962923   \n",
       "\n",
       "         num_sensitive  num_sensitive_hn  \n",
       "Drug ID                                   \n",
       "1001               476                27  \n",
       "1003               688                30  \n",
       "1004               753                33  \n",
       "1006               508                25  \n",
       "1007               584                32  \n",
       "\n",
       "[5 rows x 27 columns]"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "drug_info_df = pd.read_csv('../preprocessed_data/GDSC/hn_drug_stat.csv', index_col=0)\n",
    "drug_info_df.index = drug_info_df.index.astype(str)\n",
    "\n",
    "drug_id_name_dict = dict(zip(drug_info_df.index, drug_info_df['Drug Name'].values))\n",
    "\n",
    "drug_info_df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-11T13:04:32.644427Z",
     "start_time": "2020-07-11T13:04:32.638892Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['Afatinib',\n",
       " 'Docetaxel',\n",
       " 'Doxorubicin',\n",
       " 'Epothilone B',\n",
       " 'Gefitinib',\n",
       " 'Obatoclax Mesylate',\n",
       " 'PHA-793887',\n",
       " 'PI-103',\n",
       " 'Vorinostat']"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tested_drug_list = [1032, 1007, 133, 201, 1010] + [182, 301, 302] + [1012]\n",
    "[drug_id_name_dict[str(d)] for d in tested_drug_list]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-11T15:35:15.621968Z",
     "start_time": "2020-07-11T15:35:15.599703Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>patient</th>\n",
       "      <th>drug_id</th>\n",
       "      <th>kill</th>\n",
       "      <th>drug_name</th>\n",
       "      <th>cluster_p</th>\n",
       "      <th>cluster_kill</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>HN120</td>\n",
       "      <td>1001</td>\n",
       "      <td>39.049925</td>\n",
       "      <td>AICA Ribonucleotide</td>\n",
       "      <td>1</td>\n",
       "      <td>39.049925</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>HN120</td>\n",
       "      <td>1003</td>\n",
       "      <td>39.842087</td>\n",
       "      <td>Camptothecin</td>\n",
       "      <td>1</td>\n",
       "      <td>39.842087</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>HN120</td>\n",
       "      <td>1004</td>\n",
       "      <td>35.492878</td>\n",
       "      <td>Vinblastine</td>\n",
       "      <td>1</td>\n",
       "      <td>35.492878</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>HN120</td>\n",
       "      <td>1006</td>\n",
       "      <td>38.690576</td>\n",
       "      <td>Cytarabine</td>\n",
       "      <td>1</td>\n",
       "      <td>38.690576</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>HN120</td>\n",
       "      <td>1007</td>\n",
       "      <td>10.276450</td>\n",
       "      <td>Docetaxel</td>\n",
       "      <td>1</td>\n",
       "      <td>10.276450</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  patient drug_id       kill            drug_name  cluster_p  cluster_kill\n",
       "0   HN120    1001  39.049925  AICA Ribonucleotide          1     39.049925\n",
       "1   HN120    1003  39.842087         Camptothecin          1     39.842087\n",
       "2   HN120    1004  35.492878          Vinblastine          1     35.492878\n",
       "3   HN120    1006  38.690576           Cytarabine          1     38.690576\n",
       "4   HN120    1007  10.276450            Docetaxel          1     10.276450"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "if dosage_shifted:\n",
    "    single_drug_pred_df = pd.read_csv(current_dir + 'pred_drug_kill_{}_{}_shifted.csv'.format(ref_type, model_name))\n",
    "else:\n",
    "    single_drug_pred_df = pd.read_csv(current_dir + 'pred_drug_kill_{}_{}.csv'.format(ref_type, model_name))\n",
    "\n",
    "\n",
    "single_drug_pred_df.loc[:, 'drug_id'] = single_drug_pred_df.loc[:, 'drug_id'].values.astype(str)\n",
    "single_drug_pred_df.loc[:, 'drug_name'] = [drug_id_name_dict[d] for d in single_drug_pred_df.loc[:, 'drug_id'].values]\n",
    "\n",
    "patient_list = sorted(list(set(single_drug_pred_df['patient'])))\n",
    "# sel_drug_id_list = sorted(list(set(single_drug_pred_df['drug_id'])))\n",
    "\n",
    "single_drug_pred_df.loc[:, 'cluster_p'] = 1\n",
    "single_drug_pred_df.loc[:, 'cluster_kill'] = single_drug_pred_df['kill']\n",
    "\n",
    "single_drug_pred_df.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##### List all drug pairs"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-11T15:35:17.903903Z",
     "start_time": "2020-07-11T15:35:17.889998Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(216, 3)\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>patient</th>\n",
       "      <th>A</th>\n",
       "      <th>B</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>HN120</td>\n",
       "      <td>1032</td>\n",
       "      <td>1007</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>HN120</td>\n",
       "      <td>1032</td>\n",
       "      <td>133</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>HN120</td>\n",
       "      <td>1032</td>\n",
       "      <td>201</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>HN120</td>\n",
       "      <td>1032</td>\n",
       "      <td>1010</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>HN120</td>\n",
       "      <td>1032</td>\n",
       "      <td>182</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  patient     A     B\n",
       "0   HN120  1032  1007\n",
       "1   HN120  1032   133\n",
       "2   HN120  1032   201\n",
       "3   HN120  1032  1010\n",
       "4   HN120  1032   182"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "drug_combi_list = []\n",
    "n_drugs = len(tested_drug_list)\n",
    "\n",
    "for p in patient_list:\n",
    "    for x in range(0, n_drugs-1):\n",
    "        for y in range(x+1, n_drugs):\n",
    "            drug_x = str(tested_drug_list[x])\n",
    "            drug_y = str(tested_drug_list[y])\n",
    "\n",
    "            drug_combi_list += [[p, drug_x, drug_y]]\n",
    "\n",
    "drug_combi_df = pd.DataFrame(drug_combi_list, columns=['patient', 'A', 'B'])\n",
    "\n",
    "print (drug_combi_df.shape)\n",
    "drug_combi_df.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##### Get pred and info for each drug"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-11T15:35:46.156739Z",
     "start_time": "2020-07-11T15:35:46.140493Z"
    }
   },
   "outputs": [],
   "source": [
    "merge_df = pd.merge(drug_combi_df, single_drug_pred_df, how='left', left_on=['patient', 'A'], right_on=['patient', 'drug_id'])\n",
    "drug_combi_pred_df = pd.merge(merge_df, single_drug_pred_df[['patient', 'drug_id', 'drug_name', 'cluster_kill', 'kill']], how='left', left_on=['patient', 'B'], right_on=['patient', 'drug_id'], suffixes=['_A', '_B'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-11T15:35:47.791947Z",
     "start_time": "2020-07-11T15:35:47.774806Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>patient</th>\n",
       "      <th>A</th>\n",
       "      <th>B</th>\n",
       "      <th>drug_id_A</th>\n",
       "      <th>kill_A</th>\n",
       "      <th>drug_name_A</th>\n",
       "      <th>cluster_p</th>\n",
       "      <th>cluster_kill_A</th>\n",
       "      <th>drug_id_B</th>\n",
       "      <th>drug_name_B</th>\n",
       "      <th>cluster_kill_B</th>\n",
       "      <th>kill_B</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>HN120</td>\n",
       "      <td>1032</td>\n",
       "      <td>1007</td>\n",
       "      <td>1032</td>\n",
       "      <td>10.981192</td>\n",
       "      <td>Afatinib</td>\n",
       "      <td>1</td>\n",
       "      <td>10.981192</td>\n",
       "      <td>1007</td>\n",
       "      <td>Docetaxel</td>\n",
       "      <td>10.276450</td>\n",
       "      <td>10.276450</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>HN120</td>\n",
       "      <td>1032</td>\n",
       "      <td>133</td>\n",
       "      <td>1032</td>\n",
       "      <td>10.981192</td>\n",
       "      <td>Afatinib</td>\n",
       "      <td>1</td>\n",
       "      <td>10.981192</td>\n",
       "      <td>133</td>\n",
       "      <td>Doxorubicin</td>\n",
       "      <td>86.277729</td>\n",
       "      <td>86.277729</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>HN120</td>\n",
       "      <td>1032</td>\n",
       "      <td>201</td>\n",
       "      <td>1032</td>\n",
       "      <td>10.981192</td>\n",
       "      <td>Afatinib</td>\n",
       "      <td>1</td>\n",
       "      <td>10.981192</td>\n",
       "      <td>201</td>\n",
       "      <td>Epothilone B</td>\n",
       "      <td>77.297971</td>\n",
       "      <td>77.297971</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>HN120</td>\n",
       "      <td>1032</td>\n",
       "      <td>1010</td>\n",
       "      <td>1032</td>\n",
       "      <td>10.981192</td>\n",
       "      <td>Afatinib</td>\n",
       "      <td>1</td>\n",
       "      <td>10.981192</td>\n",
       "      <td>1010</td>\n",
       "      <td>Gefitinib</td>\n",
       "      <td>16.601540</td>\n",
       "      <td>16.601540</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>HN120</td>\n",
       "      <td>1032</td>\n",
       "      <td>182</td>\n",
       "      <td>1032</td>\n",
       "      <td>10.981192</td>\n",
       "      <td>Afatinib</td>\n",
       "      <td>1</td>\n",
       "      <td>10.981192</td>\n",
       "      <td>182</td>\n",
       "      <td>Obatoclax Mesylate</td>\n",
       "      <td>75.530122</td>\n",
       "      <td>75.530122</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  patient     A     B drug_id_A     kill_A drug_name_A  cluster_p  \\\n",
       "0   HN120  1032  1007      1032  10.981192    Afatinib          1   \n",
       "1   HN120  1032   133      1032  10.981192    Afatinib          1   \n",
       "2   HN120  1032   201      1032  10.981192    Afatinib          1   \n",
       "3   HN120  1032  1010      1032  10.981192    Afatinib          1   \n",
       "4   HN120  1032   182      1032  10.981192    Afatinib          1   \n",
       "\n",
       "   cluster_kill_A drug_id_B         drug_name_B  cluster_kill_B     kill_B  \n",
       "0       10.981192      1007           Docetaxel       10.276450  10.276450  \n",
       "1       10.981192       133         Doxorubicin       86.277729  86.277729  \n",
       "2       10.981192       201        Epothilone B       77.297971  77.297971  \n",
       "3       10.981192      1010           Gefitinib       16.601540  16.601540  \n",
       "4       10.981192       182  Obatoclax Mesylate       75.530122  75.530122  "
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "drug_combi_pred_df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-11T15:42:34.013705Z",
     "start_time": "2020-07-11T15:42:33.955239Z"
    }
   },
   "outputs": [],
   "source": [
    "rows = []\n",
    "for _, data in drug_combi_pred_df.iterrows():\n",
    "\n",
    "    \n",
    "    cluster_kill_A = data['cluster_kill_A']\n",
    "    cluster_kill_B = data['cluster_kill_B']\n",
    "    cluster_kill_C = cluster_kill_A + cluster_kill_B - np.multiply(cluster_kill_A/100, cluster_kill_B/100)*100\n",
    "    kill_C = cluster_kill_C\n",
    "    \n",
    "    best_kill = np.max([data['kill_A'], data['kill_B']])\n",
    "    improve = kill_C - best_kill\n",
    "    improve_p = (kill_C - best_kill) / best_kill\n",
    "    \n",
    "    sum_kill_dif = np.sum(np.abs(cluster_kill_A - cluster_kill_B))\n",
    "    \n",
    "    ##### save output #####\n",
    "    \n",
    "    rows += [[kill_C, improve, improve_p, sum_kill_dif]]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-11T15:42:34.448298Z",
     "start_time": "2020-07-11T15:42:34.418737Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>patient</th>\n",
       "      <th>A</th>\n",
       "      <th>B</th>\n",
       "      <th>drug_id_A</th>\n",
       "      <th>kill_A</th>\n",
       "      <th>drug_name_A</th>\n",
       "      <th>cluster_p</th>\n",
       "      <th>cluster_kill_A</th>\n",
       "      <th>drug_id_B</th>\n",
       "      <th>drug_name_B</th>\n",
       "      <th>cluster_kill_B</th>\n",
       "      <th>kill_B</th>\n",
       "      <th>kill_C</th>\n",
       "      <th>improve</th>\n",
       "      <th>improve_p</th>\n",
       "      <th>sum_kill_dif</th>\n",
       "      <th>kill_C</th>\n",
       "      <th>improve</th>\n",
       "      <th>improve_p</th>\n",
       "      <th>sum_kill_dif</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>HN120</td>\n",
       "      <td>1032</td>\n",
       "      <td>1007</td>\n",
       "      <td>1032</td>\n",
       "      <td>10.981192</td>\n",
       "      <td>Afatinib</td>\n",
       "      <td>1</td>\n",
       "      <td>10.981192</td>\n",
       "      <td>1007</td>\n",
       "      <td>Docetaxel</td>\n",
       "      <td>10.276450</td>\n",
       "      <td>10.276450</td>\n",
       "      <td>20.129166</td>\n",
       "      <td>9.147974</td>\n",
       "      <td>0.833058</td>\n",
       "      <td>0.704742</td>\n",
       "      <td>20.129166</td>\n",
       "      <td>9.147974</td>\n",
       "      <td>0.833058</td>\n",
       "      <td>0.704742</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>HN120</td>\n",
       "      <td>1032</td>\n",
       "      <td>133</td>\n",
       "      <td>1032</td>\n",
       "      <td>10.981192</td>\n",
       "      <td>Afatinib</td>\n",
       "      <td>1</td>\n",
       "      <td>10.981192</td>\n",
       "      <td>133</td>\n",
       "      <td>Doxorubicin</td>\n",
       "      <td>86.277729</td>\n",
       "      <td>86.277729</td>\n",
       "      <td>87.784598</td>\n",
       "      <td>1.506869</td>\n",
       "      <td>0.017465</td>\n",
       "      <td>75.296537</td>\n",
       "      <td>87.784598</td>\n",
       "      <td>1.506869</td>\n",
       "      <td>0.017465</td>\n",
       "      <td>75.296537</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>HN120</td>\n",
       "      <td>1032</td>\n",
       "      <td>201</td>\n",
       "      <td>1032</td>\n",
       "      <td>10.981192</td>\n",
       "      <td>Afatinib</td>\n",
       "      <td>1</td>\n",
       "      <td>10.981192</td>\n",
       "      <td>201</td>\n",
       "      <td>Epothilone B</td>\n",
       "      <td>77.297971</td>\n",
       "      <td>77.297971</td>\n",
       "      <td>79.790924</td>\n",
       "      <td>2.492953</td>\n",
       "      <td>0.032251</td>\n",
       "      <td>66.316779</td>\n",
       "      <td>79.790924</td>\n",
       "      <td>2.492953</td>\n",
       "      <td>0.032251</td>\n",
       "      <td>66.316779</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>HN120</td>\n",
       "      <td>1032</td>\n",
       "      <td>1010</td>\n",
       "      <td>1032</td>\n",
       "      <td>10.981192</td>\n",
       "      <td>Afatinib</td>\n",
       "      <td>1</td>\n",
       "      <td>10.981192</td>\n",
       "      <td>1010</td>\n",
       "      <td>Gefitinib</td>\n",
       "      <td>16.601540</td>\n",
       "      <td>16.601540</td>\n",
       "      <td>25.759685</td>\n",
       "      <td>9.158145</td>\n",
       "      <td>0.551644</td>\n",
       "      <td>5.620348</td>\n",
       "      <td>25.759685</td>\n",
       "      <td>9.158145</td>\n",
       "      <td>0.551644</td>\n",
       "      <td>5.620348</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>HN120</td>\n",
       "      <td>1032</td>\n",
       "      <td>182</td>\n",
       "      <td>1032</td>\n",
       "      <td>10.981192</td>\n",
       "      <td>Afatinib</td>\n",
       "      <td>1</td>\n",
       "      <td>10.981192</td>\n",
       "      <td>182</td>\n",
       "      <td>Obatoclax Mesylate</td>\n",
       "      <td>75.530122</td>\n",
       "      <td>75.530122</td>\n",
       "      <td>78.217207</td>\n",
       "      <td>2.687084</td>\n",
       "      <td>0.035576</td>\n",
       "      <td>64.548930</td>\n",
       "      <td>78.217207</td>\n",
       "      <td>2.687084</td>\n",
       "      <td>0.035576</td>\n",
       "      <td>64.548930</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  patient     A     B drug_id_A     kill_A drug_name_A  cluster_p  \\\n",
       "0   HN120  1032  1007      1032  10.981192    Afatinib          1   \n",
       "1   HN120  1032   133      1032  10.981192    Afatinib          1   \n",
       "2   HN120  1032   201      1032  10.981192    Afatinib          1   \n",
       "3   HN120  1032  1010      1032  10.981192    Afatinib          1   \n",
       "4   HN120  1032   182      1032  10.981192    Afatinib          1   \n",
       "\n",
       "   cluster_kill_A drug_id_B         drug_name_B  cluster_kill_B     kill_B  \\\n",
       "0       10.981192      1007           Docetaxel       10.276450  10.276450   \n",
       "1       10.981192       133         Doxorubicin       86.277729  86.277729   \n",
       "2       10.981192       201        Epothilone B       77.297971  77.297971   \n",
       "3       10.981192      1010           Gefitinib       16.601540  16.601540   \n",
       "4       10.981192       182  Obatoclax Mesylate       75.530122  75.530122   \n",
       "\n",
       "      kill_C   improve  improve_p  sum_kill_dif     kill_C   improve  \\\n",
       "0  20.129166  9.147974   0.833058      0.704742  20.129166  9.147974   \n",
       "1  87.784598  1.506869   0.017465     75.296537  87.784598  1.506869   \n",
       "2  79.790924  2.492953   0.032251     66.316779  79.790924  2.492953   \n",
       "3  25.759685  9.158145   0.551644      5.620348  25.759685  9.158145   \n",
       "4  78.217207  2.687084   0.035576     64.548930  78.217207  2.687084   \n",
       "\n",
       "   improve_p  sum_kill_dif  \n",
       "0   0.833058      0.704742  \n",
       "1   0.017465     75.296537  \n",
       "2   0.032251     66.316779  \n",
       "3   0.551644      5.620348  \n",
       "4   0.035576     64.548930  "
      ]
     },
     "execution_count": 42,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "drug_combi_pred_df = pd.concat([drug_combi_pred_df, pd.DataFrame(rows, columns=['kill_C', 'improve', 'improve_p', 'sum_kill_dif'])], axis=1)\n",
    "drug_combi_pred_df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-11T15:42:55.662396Z",
     "start_time": "2020-07-11T15:42:55.639001Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>patient</th>\n",
       "      <th>drug_id_A</th>\n",
       "      <th>drug_name_A</th>\n",
       "      <th>drug_id_B</th>\n",
       "      <th>drug_name_B</th>\n",
       "      <th>cluster_p</th>\n",
       "      <th>cluster_kill_A</th>\n",
       "      <th>cluster_kill_B</th>\n",
       "      <th>kill_A</th>\n",
       "      <th>kill_B</th>\n",
       "      <th>kill_C</th>\n",
       "      <th>kill_C</th>\n",
       "      <th>improve</th>\n",
       "      <th>improve</th>\n",
       "      <th>improve_p</th>\n",
       "      <th>improve_p</th>\n",
       "      <th>sum_kill_dif</th>\n",
       "      <th>sum_kill_dif</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>HN120</td>\n",
       "      <td>1032</td>\n",
       "      <td>Afatinib</td>\n",
       "      <td>1007</td>\n",
       "      <td>Docetaxel</td>\n",
       "      <td>1</td>\n",
       "      <td>10.981192</td>\n",
       "      <td>10.276450</td>\n",
       "      <td>10.981192</td>\n",
       "      <td>10.276450</td>\n",
       "      <td>20.129166</td>\n",
       "      <td>20.129166</td>\n",
       "      <td>9.147974</td>\n",
       "      <td>9.147974</td>\n",
       "      <td>0.833058</td>\n",
       "      <td>0.833058</td>\n",
       "      <td>0.704742</td>\n",
       "      <td>0.704742</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>HN120</td>\n",
       "      <td>1032</td>\n",
       "      <td>Afatinib</td>\n",
       "      <td>133</td>\n",
       "      <td>Doxorubicin</td>\n",
       "      <td>1</td>\n",
       "      <td>10.981192</td>\n",
       "      <td>86.277729</td>\n",
       "      <td>10.981192</td>\n",
       "      <td>86.277729</td>\n",
       "      <td>87.784598</td>\n",
       "      <td>87.784598</td>\n",
       "      <td>1.506869</td>\n",
       "      <td>1.506869</td>\n",
       "      <td>0.017465</td>\n",
       "      <td>0.017465</td>\n",
       "      <td>75.296537</td>\n",
       "      <td>75.296537</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>HN120</td>\n",
       "      <td>1032</td>\n",
       "      <td>Afatinib</td>\n",
       "      <td>201</td>\n",
       "      <td>Epothilone B</td>\n",
       "      <td>1</td>\n",
       "      <td>10.981192</td>\n",
       "      <td>77.297971</td>\n",
       "      <td>10.981192</td>\n",
       "      <td>77.297971</td>\n",
       "      <td>79.790924</td>\n",
       "      <td>79.790924</td>\n",
       "      <td>2.492953</td>\n",
       "      <td>2.492953</td>\n",
       "      <td>0.032251</td>\n",
       "      <td>0.032251</td>\n",
       "      <td>66.316779</td>\n",
       "      <td>66.316779</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>HN120</td>\n",
       "      <td>1032</td>\n",
       "      <td>Afatinib</td>\n",
       "      <td>1010</td>\n",
       "      <td>Gefitinib</td>\n",
       "      <td>1</td>\n",
       "      <td>10.981192</td>\n",
       "      <td>16.601540</td>\n",
       "      <td>10.981192</td>\n",
       "      <td>16.601540</td>\n",
       "      <td>25.759685</td>\n",
       "      <td>25.759685</td>\n",
       "      <td>9.158145</td>\n",
       "      <td>9.158145</td>\n",
       "      <td>0.551644</td>\n",
       "      <td>0.551644</td>\n",
       "      <td>5.620348</td>\n",
       "      <td>5.620348</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>HN120</td>\n",
       "      <td>1032</td>\n",
       "      <td>Afatinib</td>\n",
       "      <td>182</td>\n",
       "      <td>Obatoclax Mesylate</td>\n",
       "      <td>1</td>\n",
       "      <td>10.981192</td>\n",
       "      <td>75.530122</td>\n",
       "      <td>10.981192</td>\n",
       "      <td>75.530122</td>\n",
       "      <td>78.217207</td>\n",
       "      <td>78.217207</td>\n",
       "      <td>2.687084</td>\n",
       "      <td>2.687084</td>\n",
       "      <td>0.035576</td>\n",
       "      <td>0.035576</td>\n",
       "      <td>64.548930</td>\n",
       "      <td>64.548930</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  patient drug_id_A drug_name_A drug_id_B         drug_name_B  cluster_p  \\\n",
       "0   HN120      1032    Afatinib      1007           Docetaxel          1   \n",
       "1   HN120      1032    Afatinib       133         Doxorubicin          1   \n",
       "2   HN120      1032    Afatinib       201        Epothilone B          1   \n",
       "3   HN120      1032    Afatinib      1010           Gefitinib          1   \n",
       "4   HN120      1032    Afatinib       182  Obatoclax Mesylate          1   \n",
       "\n",
       "   cluster_kill_A  cluster_kill_B     kill_A     kill_B     kill_C     kill_C  \\\n",
       "0       10.981192       10.276450  10.981192  10.276450  20.129166  20.129166   \n",
       "1       10.981192       86.277729  10.981192  86.277729  87.784598  87.784598   \n",
       "2       10.981192       77.297971  10.981192  77.297971  79.790924  79.790924   \n",
       "3       10.981192       16.601540  10.981192  16.601540  25.759685  25.759685   \n",
       "4       10.981192       75.530122  10.981192  75.530122  78.217207  78.217207   \n",
       "\n",
       "    improve   improve  improve_p  improve_p  sum_kill_dif  sum_kill_dif  \n",
       "0  9.147974  9.147974   0.833058   0.833058      0.704742      0.704742  \n",
       "1  1.506869  1.506869   0.017465   0.017465     75.296537     75.296537  \n",
       "2  2.492953  2.492953   0.032251   0.032251     66.316779     66.316779  \n",
       "3  9.158145  9.158145   0.551644   0.551644      5.620348      5.620348  \n",
       "4  2.687084  2.687084   0.035576   0.035576     64.548930     64.548930  "
      ]
     },
     "execution_count": 44,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "drug_combi_pred_df = drug_combi_pred_df[['patient', 'drug_id_A', 'drug_name_A', 'drug_id_B', 'drug_name_B', 'cluster_p', 'cluster_kill_A', 'cluster_kill_B', 'kill_A', 'kill_B', 'kill_C', 'improve', 'improve_p', 'sum_kill_dif']]\n",
    "\n",
    "drug_combi_pred_df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-11T15:43:10.292270Z",
     "start_time": "2020-07-11T15:43:10.273252Z"
    }
   },
   "outputs": [],
   "source": [
    "if dosage_shifted:\n",
    "    drug_combi_pred_df.to_csv(current_dir + 'pred_combi_kill_{}_{}_shifted.csv'.format(ref_type, model_name), index=False)\n",
    "else:\n",
    "    drug_combi_pred_df.to_csv(current_dir + 'pred_combi_kill_{}_{}.csv'.format(ref_type, model_name), index=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.7"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": false,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
